package Java练习.字符串练习;

public class 敏感词替换 {
    public static void main(String[] args) {
        //获取到所得话
        String take="你玩的真好,下次不要玩了,TMD.";
        //定义一个敏感词库
        String[] arr={"TMD","CNM","SB","MLGB"};
        //替换:循环敏感词库,对敏感词进行依次替换
        for (int i = 0; i < arr.length; i++) {
            take=take.replace(arr[i],"***");
        }
        System.out.println(take);
    }
}
